package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 风险评估结果
 *
 * @author ytche
 * @date 2017年8月4日
 *
 */
@Entity
@Table(name = "TNB_RISK_MODEL_RESULT")
@JsonApiResource(type = "riskModelResult")
public class RiskModelResult extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private String name;
	private String remark;
	private EvaluateResult evaluateResult;
	private RiskLevel level;
	private RiskRecordResult riskResult;

	@Column(name = "name")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "evaluate_result_id")
	@JsonApiToOne
	@JsonApiIncludeByDefault
	public EvaluateResult getEvaluateResult() {
		return evaluateResult;
	}

	public void setEvaluateResult(EvaluateResult evaluateResult) {
		this.evaluateResult = evaluateResult;
	}

	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "level_id")
	@JsonApiToOne
	@JsonApiIncludeByDefault
	public RiskLevel getLevel() {
		return level;
	}

	public void setLevel(RiskLevel level) {
		this.level = level;
	}

	@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "risk_result_id")
	@JsonApiToOne
	@JsonApiIncludeByDefault
	public RiskRecordResult getRiskResult() {
		return riskResult;
	}

	public void setRiskResult(RiskRecordResult riskResult) {
		this.riskResult = riskResult;
	}
}
